DAX Functions and Their Purpose
1. BestSellingProductsPerCity
BestSellingProductsPerCity =
ADDCOLUMNS(
SUMMARIZE(
'data',
'data'[State],
'data'[Category],
"TotalSales", SUM('data'[Sales])
),
"Rank",
RANKX(
FILTER(
SUMMARIZE(
'data',
'data'[State],
'data'[Category],
"TotalSales", SUM('data'[Sales])
),
'data'[State] = EARLIER('data'[State])
),
[TotalSales],,
DESC
)
)
Purpose and Significance: The BestSellingProductsPerCity
function identifies the top-selling products in each city by category. By ranking products based on total sales within each state, this function provides a granular view of product performance across different regions. This visualization helps stakeholders understand regional preferences, enabling targeted marketing strategies and inventory management.
2. Top10SellingCategoryTable
Top10SellingCategoryTable =
TOPN(
10,
SUMMARIZE(
data,
data[Category],
"TotalSales", SUM(data[Sales])
),
[TotalSales],
DESC
)
Purpose and Significance: The Top10SellingCategoryTable
function extracts the top 10 selling categories based on total sales. This visualization highlights the most profitable product categories, allowing stakeholders to focus on high-performing areas and optimize product offerings. It provides a clear picture of consumer demand trends, aiding in strategic planning and resource allocation.
3. Top10SellingProductsTable
Top10SellingProductsTable =
TOPN(
10,
SUMMARIZE(
data,
data[Product],
"TotalSales", SUM(data[Sales])
),
[TotalSales],
DESC
)
Purpose and Significance: Similar to the category analysis, the Top10SellingProductsTable
function identifies the top 10 selling products. This visualization offers insights into specific product popularity, helping stakeholders make informed decisions about product promotions, pricing strategies, and inventory levels.
4. TotalProfitByYear
TotalProfitByYear =
SUMMARIZE(
data,
data[Order Date],
"Year", YEAR(data[Order Date]),
"TotalProfit", SUM(data[Profit])
)
Purpose and Significance: The TotalProfitByYear
function aggregates profit data on an annual basis. By visualizing profit trends over time, stakeholders can assess the financial health of the business and identify growth patterns or areas of concern. This analysis supports long-term strategic planning and financial forecasting.